//
//  CollectTableViewCell.m
//  XWZ_News_Work
//
//  Created by dllo on 16/1/18.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CollectTableViewCell.h"

@interface CollectTableViewCell()

@property (nonatomic, strong) UIView *backV;

@end

@implementation CollectTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.backV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(@5);
        make.top.equalTo(@5);
        make.right.equalTo(self.contentView).offset(-5);
        make.bottom.equalTo(self.contentView).offset(-5);
        
    }];
    
    [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(@10);
        make.left.equalTo(@10);
        make.width.equalTo(self.contentView).multipliedBy(0.333);
        make.bottom.equalTo(self.contentView).offset(-10);
    }];
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.imageV);
        make.left.equalTo(self.imageV.mas_right).offset(10);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(@50);
    }];
    [self.timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.titleLab.mas_bottom).offset(1);

        make.width.equalTo(@150);
        make.right.equalTo(self.contentView).offset(-10);
        make.bottom.equalTo(self.contentView).offset(-10);
    
    }];
    
}

- (void)createSubviews
{
    self.backgroundColor = [UIColor colorWithRed:191 / 255.0 green:191 / 255.0 blue:191 / 255.0 alpha:1.0];
    
    self.backV = [UIView new];
    self.backV.layer.cornerRadius = 5;
    self.backV.layer.masksToBounds = YES;
    self.backV.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.backV];
    
    self.imageV = [UIImageView new];
    [self.contentView addSubview:self.imageV];
    
    self.titleLab = [UILabel new];
    self.titleLab.numberOfLines = 0;
    [self.contentView addSubview:self.titleLab];
    
    self.timeLab = [UILabel new];
    self.timeLab.font = [UIFont systemFontOfSize:13];
    self.timeLab.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.timeLab];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
